//////////////////////////////////////////////////////////////////////////////////////////
//	FPS_COUNTER.h
//	Frames per sceond counter class
//	Downloaded from: www.paulsprojects.net
//	Created:	20th July 2002
//
//	Copyright (c) 2006, Paul Baker
//	Distributed under the New BSD Licence. (See accompanying file License.txt or copy at
//	http://www.paulsprojects.net/NewBSDLicense.txt)
//////////////////////////////////////////////////////////////////////////////////////////

#ifndef FPS_COUNTER_H
#define FPS_COUNTER_H

class FPS_COUNTER
{
protected:
	float fps;

	float lastTime;
	int frames;
	float time;
	float buffer;

public:
void Update(void)
{
	//keep track of time passed and frame count
	time = (float)(timeGetTime()*0.001f);
	//frames++;

	//If a second has passed
	if(time-lastTime>1.0f)
	{
		
		fps = (lastTime);	//update the number of frames per second
		lastTime = (float)time;				//set time for the start of the next count
		time=0.0f;
		frames=0;					//reset fps for this second
	}
}


	float GetFps(void)	{	return fps;	}

	FPS_COUNTER(){		
		fps=0.0f;
		lastTime=0.0f; 
		frames=0;
		time=0.0f;
	};
	~FPS_COUNTER()	{};

};

#endif	//FPS_COUNTER_H